From 51b6900b84eb965c36752c9cf8d91af0c29182dd Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Sun, 25 Feb 2007 23:45:39 +0000 Subject: [PATCH] Redefine units of VDI.virtual_size to be bytes, not sectors. Signed-off-by: Ewan Mellor --- docs/xen-api/xenapi-datamodel.tex | 2 +- tools/python/scripts/test_vm_create.py | 2 +- tools/python/scripts/xapi.py | 4 ++-- tools/python/scripts/xapi.vdicfg.py | 2 +- tools/python/xen/xend/XendQCoWStorageRepo.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index 97cbab5149..2978c06ff3 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -9617,7 +9617,7 @@ $\mathit{RW}$ & {\tt name/description} & string & a notes field containg human- $\mathit{RW}$ & {\tt SR} & SR ref & storage repository in which the VDI resides \\ $\mathit{RO}_\mathit{run}$ & {\tt VBDs} & (VBD ref) Set & list of vbds that refer to this disk \\ $\mathit{RO}_\mathit{run}$ & {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\ -$\mathit{RW}$ & {\tt virtual\_size} & int & size of disk as presented to the guest (in multiples of sector\_size field) \\ +$\mathit{RW}$ & {\tt virtual\_size} & int & size of disk as presented to the guest (in bytes). Note that, depending on storage backend type, requested size may not be respected exactly \\ $\mathit{RO}_\mathit{run}$ & {\tt physical\_utilisation} & int & amount of physical space that the disk image is currently taking up on the storage repository (in bytes) \\ $\mathit{RO}_\mathit{ins}$ & {\tt sector\_size} & int & sector size of VDI (in bytes) \\ $\mathit{RO}_\mathit{ins}$ & {\tt type} & vdi\_type & type of the VDI \\ diff --git a/tools/python/scripts/test_vm_create.py b/tools/python/scripts/test_vm_create.py index 84959c3e0d..e4d8f3023a 100644 --- a/tools/python/scripts/test_vm_create.py +++ b/tools/python/scripts/test_vm_create.py @@ -39,7 +39,7 @@ vm_cfg = { vdi_cfg = { 'name_label': 'API_VDI', 'name_description': '', - 'virtual_size': 100 * 1024, + 'virtual_size': 100 * 1024 * 1024, 'sector_size': 1024, 'type': 'system', 'parent': '', diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py index b5fe8b3682..1e49f86d4c 100644 --- a/tools/python/scripts/xapi.py +++ b/tools/python/scripts/xapi.py @@ -569,7 +569,7 @@ def xapi_vdi_list(args, async = False): if not is_long: print VDI_LIST_FORMAT % {'name_label': 'VDI Label', 'uuid' : 'UUID', - 'virtual_size': 'Sectors', + 'virtual_size': 'Bytes', 'sector_size': 'Sector Size'} for vdi in vdis: @@ -628,7 +628,7 @@ def xapi_vdi_create(args, async = False): sr = srs[0] cfg['SR'] = sr - size = (cfg['virtual_size'] * cfg['sector_size'])/MB + size = cfg['virtual_size']/MB print 'Creating VDI of size: %dMB ..' % size, uuid = execute(server, 'VDI.create', (session, cfg), async = async) if async: diff --git a/tools/python/scripts/xapi.vdicfg.py b/tools/python/scripts/xapi.vdicfg.py index f694b83cf5..86129bfae9 100644 --- a/tools/python/scripts/xapi.vdicfg.py +++ b/tools/python/scripts/xapi.vdicfg.py @@ -1,6 +1,6 @@ name_label = 'VDI 1' name_description = '' -virtual_size = 10 * 1024 +virtual_size = 10 * 1024 * 1024 sector_size = 1024 type = 'system' sharable = False diff --git a/tools/python/xen/xend/XendQCoWStorageRepo.py b/tools/python/xen/xend/XendQCoWStorageRepo.py index 763d76da8b..ad4fa7fb88 100644 --- a/tools/python/xen/xend/XendQCoWStorageRepo.py +++ b/tools/python/xen/xend/XendQCoWStorageRepo.py @@ -326,7 +326,7 @@ class XendQCoWStorageRepo(XendStorageRepository): image = self.images[image_uuid] image_cfg = { 'sector_size': sector_size, - 'virtual_size': sector_count, + 'virtual_size': size_bytes, 'type': vdi_struct.get('type', 'system'), 'name_label': vdi_struct.get('name_label', ''), 'name_description': vdi_struct.get('name_description', ''), -- 2.30.2